/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.zypapp.backingBean;

import it.zypapp.entity.Capi;
import it.zypapp.util.SessionHibernateUtil;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

/**
 *
 * @author utente
 */
public class Menu {
    
    public List getCapi() {
      SessionFactory sf = SessionHibernateUtil.getSessionFactory();
    Session session = sf.openSession();
    session.beginTransaction();
 
    Capi capi = new Capi();
    capi.setDescrizione("NUOVA DESCRIZIONE");
    capi.setIdCapo(11);
    List employees = session.createQuery("from Capi").list();
    session.getTransaction().commit();
    /*     
    session.close();
    Iterator i = employees.iterator();
    while (i.hasNext()) {
        Capi capo = (Capi )i.next();
        System.out.println(capo.getDescrizione());
    }   
    */    
    return employees;
    }
   
    //1return employee
    }
    

